package link.jfire.socket.test;

import java.nio.charset.Charset;
import link.jfire.baseutil.simplelog.ConsoleLogFactory;
import link.jfire.baseutil.simplelog.Logger;
import link.jfire.socket.socketserver.transfer.server.ServerConfig;
import link.jfire.socket.socketserver.transfer.server.ServerMain;
import org.junit.AfterClass;
import org.junit.BeforeClass;

public class BaseTestSupport
{
    protected Logger            logger     = ConsoleLogFactory.getLogger();
    protected static ServerMain serverMain = null;
    protected Charset           charset    = Charset.forName("utf-8");
    
    @BeforeClass
    public static void before()
    {
        ServerConfig serverConfig = new ServerConfig();
        serverConfig.setPort(80);
        // serverConfig.setWaitStrategy(new CirculationWaitStrategy(50));
//        serverConfig.setHandlerThreadSize(1);
//        serverConfig.setWaitStrategy(new SleepWaitStrategy(5));
//         serverConfig.setWaitStrategy(new BusyWaitStrategy());
        serverConfig.setSocketThreadSize(4);
        serverMain = new ServerMain(serverConfig);
        serverMain.start();
    }
    
    @AfterClass
    public static void after()
    {
        serverMain.stop();
    }
}
